package org.langqiao.datatype;


public class TestDataType {
	
	public static void main(String[] args){
		//testFloat();
		testChar();
	}
	
	//测试整数类型：byte,short,int,long。以及进制之间的转换问题
	public static void testInteger(){
		int a = 10;
		int a2 = 010;
		int a3 = 0xf;
	//	byte b = 200;
	//	System.out.println(b);
		System.out.println(a);
		System.out.println(a2);
		System.out.println(a3);
		System.out.println(Integer.toBinaryString(a));
		System.out.println(Integer.toOctalString(a));
		System.out.println(Integer.toHexString(a));
		
		int a5 = 10;
		long a6 = 200;
		byte b2 = 100;   //�����ݵĴ�Сû�г���byte/short/char�ı�����Χ��������Զ�ת�͡�
		
		long  a7 = 11123213232L;
		long l = 3;
		long l2 = l+3;    //L����
	}
	
	//测试float
	public static void testFloat(){
		//double d = 3.14;   //浮点数常量默认类型是double。
		//float f = 6.28F;
		double d2 = 314e-2;   //采用科学计数法的写法
		System.out.println(d2);
		
		float f = 0.1f;
		double d = 1.0/10;
		System.out.println(f==d);   //false
	}
	
	//测试char
	public static void testChar(){
			
		/*char c1 = 'a';
		char c2 = '尚';   //unicode  2: 0-65535
		char c3 = '\n';
		System.out.print(c1);
		System.out.print(c3);
		System.out.print(c2);*/
	
	
		char c4 = 'a';
		int i = c4 + 2;
		char c5 = (char)i;   //强制转型
		System.out.println(c5);
		
		//循环打印a-z
		for(int j=0;j<26;j++){
			char temp = (char)(c4+j);
			System.out.print(temp);
		}
		
		//java里面的字符串，是定义成：String类了。
		String  str = "abcdefghijklmnopqrstuvwxyz";
		System.out.println("\n"+str);
	
		boolean b = false;   //false
		if(b){    
			System.out.println("true");
		}
	}

}